import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("application.xml");
        Student xyj = context.getBean("xyj",Student.class);
        System.out.println(xyj);

//        ApplicationContext context = new ClassPathXmlApplicationContext("application.xml");
//        //获取bean 方法1（bean-id)
//        Student xyj = (Student) context.getBean("xyj");
//        System.out.println(xyj);
//
//        //获取bean 方法2( .class)
//        Student xyj2 = (Student) context.getBean(Student.class);
//        System.out.println(xyj2);
//
//        //获取bean 方法3(bean-id + .class ”即方法1+方法2“）
//        Student xyj3 =context.getBean("xyj",Student.class);
//        System.out.println(xyj3);

    }
}
